/*
 * This source code is part of TWaver 4.0
 *
 * Serva Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * Copyright 2002 - 2011 Serva Software. All rights reserved.
 */

package demo.network.miscellaneous.instrument.elementui;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;

import twaver.TWaverUtil;
import twaver.network.ui.DefaultBorderUI;

public class ClockBorderUI extends DefaultBorderUI{

	public ClockBorderUI(ClockUI clockUI) {
		super(clockUI);
	}

    /**
     * The inset between selection border and element.
     * Subclass can override this method to give a different inset.
     *
     * @return inset value.
     */
    public int getBorderInset() {
        return 8;
    }
    
    /**
     * Paint this element border on this graphics.
     *
     * @param g graphics object.
     * @param element element object.
     */
    public void paintBorder(Graphics2D g2d) {
    	if(!this.isVisible()){
    		return;
    	}
        Rectangle bounds = getElement().getBounds();
        bounds.grow(6, 6);   
        
        g2d.setStroke(TWaverUtil.createStroke(3));
        g2d.setColor(Color.WHITE);
        
		Object oldHinds = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.drawArc(bounds.x, bounds.y, bounds.width, bounds.height, 0, 360);
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldHinds);
    }
    

}